import mmcv

import os

imgFolder = "G:\数据集\植保所\分类目标图片\斑潜蝇\归类后数据\按物种归类\\other"
imagePaths = os.listdir(imgFolder)


for imageName in imagePaths:
    imagePath= os.path.join(imgFolder,imageName)
    #print(imagePath)

    result=mmcv.imread(imagePath)
    if(result is None):
        print(imagePath)
        #os.remove(imagePath)
#     myImageList = os.listdir(path)
#     print(myImageList)
#     print(f'Tatal images deteted is  {len(myImageList)}')
#
#     images = []
#
#     for imagN in myImageList:
#         curImg = cv2.imread(f'{path}/{imagN}')
#         curImg = cv2.resize(curImg, (0, 0), None, 0.2, 0.2)
#         images.append(curImg)
#     print(len(images))
#
# mmcv.imread